package com.itbaiyun.usercenter.model.enums;

import lombok.Getter;

/**
 * 队伍状态枚举
 */
@Getter
public enum TeamStatusEnum {

    PUBLIC(0, "公开"),
    PRIVATE(1, "私有"),
    SECRET(2, "加密");

    /**
     * 状态码
     */
    private int code;

    /**
     * 状态描述
     */
    private String description;

    TeamStatusEnum(int code, String description) {
        this.code = code;
        this.description = description;
    }

    public int getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    public static TeamStatusEnum getEnumByCode(Integer code) {
        if (code == null) {
            return null;
        }
        TeamStatusEnum[] values = TeamStatusEnum.values();
        for (TeamStatusEnum teamStatusEnum : values) {
            if (teamStatusEnum.getCode() == code) {
                return teamStatusEnum;
            }
        }
        return null;
    }
}
